Skip to content

fix get_current_namespace #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

carsonmh
Copy link
Contributor

Issue link

closes #289

What changes have been made

Sometimes when the user has an api_client, they don't always want to search the serviceaccount. So this PR changes the get_current_namespace so that it always checks both the serviceaccount and kubeconfig for current namespace

Verification steps

Try logging out of cluster with oc logout and logging in through TokenAuthentication. Calling get_current_namespace should yield the correct result. With the old get_current_namespace it would print that namespace is not available

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 11, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign maxusmusti for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Maxusmusti Maxusmusti added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2023
Copy link
Contributor

@Bobbins228 Bobbins228 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing this on an OSD Cluster I was unable to delete /var/run/secrets/kubernetes.io/serviceaccount/namespace because it is read only. I changed the code to look for a file that doesn't exist instead.

When creating an appwrapper after logging in via the token authentication in a Jupyter Notebook I got a ConfigException: Invalid kube-config file. No configuration found. error.

As things stand at the moment if a user lacks a config file and the namespace file there is an error when calling get_current_namespace() even if they have authenticated via the token and server with TokenAuthentication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_current_namespace broken due to authentication change
3 participants